/*
 * @Author: shengduiliang 1107722390@qq.com
 * @Date: 2024-05-04 14:32:45
 * @LastEditors: shengduiliang 1107722390@qq.com
 * @LastEditTime: 2024-05-04 14:43:05
 * @FilePath: /treasure/src/network/auth.ts
 * @Description: 用户登录
 */
import Taro from "@tarojs/taro"
import { cookie } from "@/utils";

const login = async () => {
  const { code } = await Taro.login()
  const { cookies } = await Taro.request({
    url: `${process.env.TARO_APP_BASE_URL}/mini/login?miniCode=${code}`,
    method: "POST",
  });
  cookie.set(cookies ? cookies[0] : '')
}

export default {
  login
}